﻿using System;
using System.Text;
using System.Data;
using System.Collections;
using DataBaseConnection;

namespace DataEntity
{
    /// <summary>
    /// 广告
    /// </summary>
    public partial class tab_Advertisement : IEntity
    {
        /// <summary>
        /// 选择一个广告发布(广告+版位)
        /// </summary>
        public static DataTable SelectForShow(bool IsActive, int ID)
        {
            string sql =
@"SELECT t.*, tz.* FROM tab_Advertisement t 
INNER JOIN tab_AdZone AS tz 
ON t.adv_ZoneID = tz.adz_ID
WHERE ";
            if (IsActive)
            {
                sql += "t.adv_IsActive = true";
            }
            else { sql += "t.adv_ID = " + ID; }

            return DataEntity.Common.ExecuteDataSet(sql, null, null).Tables[0];
        }
    }
}

